package org.beetl.json;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;

import org.beetl.json.node.ClassNode;

public class Policy {
	public ClassNode  classNode ;
	public Policy(ClassNode classNode){
		this.classNode = classNode;
	}
	public String toJson(Object obj)throws IOException {
		StringWriter sw = new StringWriter();
		toJson(sw,obj);
		return sw.toString();
	}
	
	public void toJson(Writer writer,Object obj) throws IOException{
		classNode.render(obj, writer,"");
	}
}
